package com.hzqy.web.ac.epg;

import com.hzqy.commons.utils.ExcelUtil;
import com.hzqy.service.epg.AcProductService;
import com.hzqy.service.system.SysVoProcessServiceBeen;
import com.hzqy.web.vo.epg.ActivityProductVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;

@Controller
@RequestMapping("statistics/acProduct")
public class StatisticsActivityProductAction {
    @Resource
    private SysVoProcessServiceBeen voProcessServiceBean;
    @Resource
	private AcProductService serviceAction;
    
    @RequestMapping("ac_excel_list")
    public void acProductExcel(ActivityProductVo acp, HttpServletResponse response) throws IOException {
        Map<String,Object> acListMap = new HashMap<String, Object>();
        acListMap =  serviceAction.selectAcExcelList(acp);
        List<ActivityProductVo> list=new ArrayList<ActivityProductVo>();
        list = (List<ActivityProductVo>)acListMap.get("rows");
        voProcessServiceBean.voProcess(list);
        List<ExcelUtil.MyEntry<String, String>> excelCpHeader=new ArrayList<ExcelUtil.MyEntry<String, String>>();
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_id","挽留活动唯一ID"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_name","地挽留活动名称"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_desc","挽留活动描述"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_type","类型"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_productcode","IPTV 产品编号"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_heaven","到期后几天弹窗"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_frequency","每自然月弹窗次数"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_startdate","弹窗开始时间"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_enddate","弹窗结束时间"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_udate","更新时间"));
        excelCpHeader.add(new ExcelUtil.MyEntry<String,String>("f_ap_cdate","创建时间"));
        boolean flag=ExcelUtil.generateExcel(list, excelCpHeader, response);
    }


}
